﻿<%@ Page Language="C#" MasterPageFile="~/Admin/admin.master" AutoEventWireup="true"
    CodeFile="AdjustmentEdit.aspx.cs" Inherits="Admin_AdjustmentEdit" Title="" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <data:MultiFormView ID="FormView1" DataKeyNames="AdjustmentId" runat="server" DataSourceID="AdjustmentDataSource"
        OnItemCommand="FormView1_ItemCommand">
        <EditItemTemplatePaths>
            <data:TemplatePath Path="~/Admin/UserControls/AdjustmentFields.ascx" />
        </EditItemTemplatePaths>
        <InsertItemTemplatePaths>
            <data:TemplatePath Path="~/Admin/UserControls/AdjustmentFields.ascx" />
        </InsertItemTemplatePaths>
        <EmptyDataTemplate>
            <b>Adjustment not found!</b>
        </EmptyDataTemplate>
        <FooterTemplate>
            <asp:Button ID="InsertButton" runat="server" CausesValidation="True" Visible="False"
                CommandName="Insert" Text="Insert" CssClass="button" />
            <asp:Button ID="UpdateButton" runat="server" CausesValidation="True" Visible="False"
                CommandName="Update" Text="Update" CssClass="button" />
            <asp:Button ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                Text="Back" CssClass="button" />
            <asp:Button ID="PreviewButton" runat="server" CausesValidation="True" CommandName="Preview"
                ToolTip="Print Preview" Text="Preview" ValidationGroup="Main" CssClass="button" />
        </FooterTemplate>
    </data:MultiFormView>
    <data:AdjustmentDataSource ID="AdjustmentDataSource" runat="server" SelectMethod="GetByAdjustmentId">
        <Parameters>
            <asp:QueryStringParameter Name="AdjustmentId" QueryStringField="AdjustmentId" Type="String" />
        </Parameters>
    </data:AdjustmentDataSource>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <data:GridViewSearchPanel ID="GridViewSearchPanel1" runat="server" GridViewControlID="GridView1"
        Visible='<%# FormView1.DefaultMode != FormViewMode.Insert %>' />
    <br />
    <data:EntityGridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
        DataSourceID="AdjustmentDetailsDataSource" DataKeyNames="StockOutDetailId" AllowMultiColumnSorting="False"
        DefaultSortColumnName="DrugId" DefaultSortDirection="Ascending" ExcelExportFileName="Export_AdjustmentDetail.xls"
        AllowExportToExcel="False" AllowPaging="True" AllowSorting="True" ExportToExcelText="Excel"
        PageSelectorPageSizeInterval="20" RecordsCount="0" ShowGridOnEmptyData="False">
        <Columns>
            <asp:TemplateField HeaderText="Drug Id" SortExpression="[DrugId]">
                <ItemTemplate>
                    <asp:Label ID="lblDrugId" runat="server" Text='<%# Eval("DrugId") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <data:HyperLinkField HeaderText="Drug Name" DataNavigateUrlFormatString="DrugDispoEdit.aspx?DrugId={0}"
                DataNavigateUrlFields="DrugId" DataContainer="DrugIdSource" DataTextField="DrugName" />
            <asp:TemplateField HeaderText="Current Quantity" SortExpression="[Quantity]" ItemStyle-Width="100">
                <ItemTemplate>
                    <asp:Label ID="lblQuantity" runat="server" Text='<%# Eval("Quantity","{0:#,##0}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Adjust Quantity" SortExpression="[AdjustQuantity]"
                ItemStyle-Width="100">
                <ItemTemplate>
                    <asp:Label ID="lblAdjustQuantity" runat="server" Text='<%# Eval("AdjustQuantity","{0:#,##0}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Final Quantity" SortExpression="[FinalQuantity]" ItemStyle-Width="100">
                <ItemTemplate>
                    <asp:Label ID="lblFinalQuantity" runat="server" Text='<%# Eval("FinalQuantity","{0:#,##0}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Remark" SortExpression="[Remark]">
                <ItemTemplate>
                    <asp:Label ID="lblRemark" runat="server" Text='<%# Eval("Remark") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <b>No Adjustment Details Found!</b>
        </EmptyDataTemplate>
    </data:EntityGridView>
    <br />
    <asp:HiddenField ID="WhereClauseHiddenField" runat="server" Value="" Visible="false" />
    <data:AdjustmentDetailsDataSource ID="AdjustmentDetailsDataSource" runat="server"
        SelectMethod="GetPaged" EnablePaging="true" EnableSorting="true" EnableDeepLoad="True">
        <DeepLoadProperties Method="IncludeChildren" Recursive="False">
            <Types>
                <data:AdjustmentDetailsProperty Name="Adjustment" />
                <data:AdjustmentDetailsProperty Name="DrugDispo" />
            </Types>
        </DeepLoadProperties>
        <Parameters>
            <asp:ControlParameter Name="WhereClause" ControlID="WhereClauseHiddenField" PropertyName="Value" />
            <data:CustomParameter Name="WhereClause" Value="" ConvertEmptyStringToNull="false" />
            <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
            <asp:ControlParameter Name="PageIndex" ControlID="GridView1" PropertyName="PageIndex"
                Type="Int32" />
            <asp:ControlParameter Name="PageSize" ControlID="GridView1" PropertyName="PageSize"
                Type="Int32" />
            <data:CustomParameter Name="RecordCount" Value="0" Type="Int32" />
        </Parameters>
    </data:AdjustmentDetailsDataSource>
    <br />
</asp:Content>
